package org.yangspring.samples.mvc.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.yangspring.samples.mvc.dao.AnimalDao;
import org.yangspring.samples.mvc.domain.AnimalJoin;

import java.util.List;

/**
 * Created by whyang on 2017/06/19.
 */

@Service
public class AnimalJoinServiceImpl implements AnimalJoinService {

    @Autowired
    private AnimalDao animalDao;

    /*public void setAnimalDao(AnimalDao dao){
        this.animalDao = dao;
    }*/

    @Transactional
    public void addAnimal(AnimalJoin animal){

        this.animalDao.addAnimal(animal);
    }

    @Transactional
    public void updateAnimal(AnimalJoin animal){

        this.animalDao.updateAnimal(animal);
    }

    @Transactional
    public List<AnimalJoin> listAnimal(){
        return this.animalDao.listAnimal();
    }

    @Transactional
    public AnimalJoin getAnimalById(long id){

        return this.animalDao.getAnimalById(id);
    }

    @Transactional
    public void removeAnimal(long id){
        this.animalDao.removeAnimal(id);
    }


}
